package org.example.design.visitor.test1;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author huangshen
 * @version 0
 * @description File
 * @since 2022/2/9 21:43
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class File extends Entry {

    private String name;

    private int size;

    public File(String name, int size) {
        this.name = name;
        this.size = size;
    }
    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getSize() {
        return size;
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);
    }

    @Override
    public String toString() {
        return getName() + "(" + getSize() + ")" ;
    }
}
